<?php

include './Adapter.php';

class HttpRequest
{
    private $adapter;

    public function __construct(Adapter $adapter)
    {
        $this->adapter = $adapter;
    }

    public function fetch(string $url)
    {
        return $this->adapter->request($url);
    }
}

include './AjaxAdapter.php';

$res = (new HttpRequest((new AjaxAdapter())))->fetch('www.baidu.com');
var_dump($res);